﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using SilverMindMap.Core.Model;

namespace SilverMindMap.Demo
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void OnControlLoaded(object sender, RoutedEventArgs e)
        {
            this.mindMapControl.MindMap = CreateMindMap();
        }

        private MindMap CreateMindMap()
        {
            var result = new MindMap();

            var rootNode = new Node("Testing Silverlight") { BackgroundColor = Color.FromArgb(255, 237, 28, 36), Hyperlink = new Uri("http://silvermindmap.codeplex.com/documentation") };
            result.AddNode(rootNode);

            var guiTesting = new Node("GUI Testing") { BackgroundColor = Color.FromArgb(255, 255, 247, 153), ForegroundColor = Colors.DarkGray };
            result.AddNode(guiTesting); rootNode.AddLink(guiTesting);
            var vsFeaturePack = new Node("Visual Studio 2010 Feature Pack") { BackgroundColor = Color.FromArgb(255, 255, 247, 153), ForegroundColor = Colors.DarkGray };
            result.AddNode(vsFeaturePack); guiTesting.AddLink(vsFeaturePack);
            var silvernium = new Node("Silvernium") { BackgroundColor = Color.FromArgb(255, 255, 247, 153), ForegroundColor = Colors.DarkGray };
            result.AddNode(silvernium); guiTesting.AddLink(silvernium);

            var unitTesting = new Node("Unit Testing") { BackgroundColor = Color.FromArgb(255, 141, 198, 63), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=Unit%20testing%20-%20overview") };
            result.AddNode(unitTesting); rootNode.AddLink(unitTesting);
            var sutf = new Node("Silverlight Unit Testing Framework") { BackgroundColor = Color.FromArgb(255, 141, 198, 63), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=Silverlight%20Unit%20Testing%20Framework") }; 
            result.AddNode(sutf); unitTesting.AddLink(sutf);
            var silverUnit = new Node("SilverUnit") { BackgroundColor = Color.FromArgb(255, 141, 198, 63), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=SilverUnit") };
            result.AddNode(silverUnit); unitTesting.AddLink(silverUnit);
            var unitDriven = new Node("UnitDriven") { BackgroundColor = Color.FromArgb(255, 196, 223, 155), ForegroundColor = Colors.DarkGray };
            result.AddNode(unitDriven); unitTesting.AddLink(unitDriven);

            var testRunners = new Node("Test runners") { BackgroundColor = Color.FromArgb(255, 253, 198, 137), ForegroundColor = Colors.DarkGray };
            result.AddNode(testRunners); rootNode.AddLink(testRunners);
            var lighthouse = new Node("Lighthouse") { BackgroundColor = Color.FromArgb(255, 247, 148, 29), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=Lighthouse") };
            result.AddNode(lighthouse); testRunners.AddLink(lighthouse);
            var statLight = new Node("StatLight") { BackgroundColor = Color.FromArgb(255, 247, 148, 29), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=StatLight") };
            result.AddNode(statLight); testRunners.AddLink(statLight);

            var mockingObjects = new Node("Mocking objects") { BackgroundColor = Color.FromArgb(255, 0, 174, 239), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=Mocking%20objects") };
            result.AddNode(mockingObjects); rootNode.AddLink(mockingObjects);
            var moq = new Node("Moq") { BackgroundColor = Color.FromArgb(255, 0, 174, 239), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=Moq") };
            result.AddNode(moq); mockingObjects.AddLink(moq);
            var rhinoMock = new Node("RhinoMock") { BackgroundColor = Color.FromArgb(255, 0, 174, 239), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=RhinkMock") };
            result.AddNode(rhinoMock); mockingObjects.AddLink(rhinoMock);
            var typeMock = new Node("TypeMock") { BackgroundColor = Color.FromArgb(255, 109, 207, 248), ForegroundColor = Colors.DarkGray };
            result.AddNode(typeMock); mockingObjects.AddLink(typeMock);

            var goodPractices = new Node("Good practices") { BackgroundColor = Color.FromArgb(255, 161, 134, 190), ForegroundColor = Colors.DarkGray };
            result.AddNode(goodPractices); rootNode.AddLink(goodPractices);
            var designPatterns = new Node("Design patterns") { BackgroundColor = Color.FromArgb(255, 161, 134, 190), ForegroundColor = Colors.DarkGray };
            result.AddNode(designPatterns); goodPractices.AddLink(designPatterns);
            var mvvm = new Node("MVVM") { BackgroundColor = Color.FromArgb(255, 161, 134, 190), Hyperlink = new Uri("http://silvermindmap.codeplex.com/wikipage?title=Model-View-ViewModel") };
            result.AddNode(mvvm); designPatterns.AddLink(mvvm);
            var testingTricks = new Node("Testing tricks") { BackgroundColor = Color.FromArgb(255, 161, 134, 190), ForegroundColor = Colors.DarkGray };
            result.AddNode(testingTricks); goodPractices.AddLink(testingTricks);
            var userInitiatedActions = new Node("Testing user-initiated actions") { BackgroundColor = Color.FromArgb(255, 161, 134, 190), ForegroundColor = Colors.DarkGray };
            result.AddNode(userInitiatedActions); testingTricks.AddLink(userInitiatedActions);
            
            result.RootNode = rootNode;

            return result;
        }
    }
}
